{% extends "base.html" %}

{% load accounts_tags %}

{% block title %}{{ block.super }} - Ledger{% endblock %}

{% block extrahead %}
<link href="/media/css/accounts.css" rel="stylesheet" type="text/css" />
{% endblock %}

{% block content %}
<table class="full">
	<img src="{{ account.graph }}" />
	<pre>{{ account.graph }}</pre>

	<caption>Actions for {{ account.name }}</caption>
	{% if page.has_other_pages %}
	<thead>
	<tr>
		<th colspan="100%">
			<a href="?page=1">&lt;&lt; Start</a> |
		{% if page.has_previous %}
			<a href="?page={{ page.previous_page_number }}">&lt; Prev</a> |
		{% endif %}
		{{ page }}
		{% if page.has_next %}
			| <a href="?page={{ page.next_page_number }}">Next &gt;</a>
		{% endif %}
			| <a href="?page={{ pages.num_pages }}">End &gt;&gt;</a>
		</th>
	</tr>
	</thead>
	{% endif %}
	{% for action in page.object_list %}
	<tr class="ledger {% cycle 'even' 'odd' %}">
		<td>{{ action.entry.date|date:"d-M-y" }}</td>
		<td class="money {{ action.amount|gte:0|yesno:'positive,negative' }}">
            {{ action.amount|floatformat:2 }}
        </td>
		<td>{{ action.entry.description }}</td>
	</tr>
	{% endfor %}
</table>
{% endblock %}

